﻿namespace OpenGameEngine.Scenes
{
    using System;
    using System.Collections.ObjectModel;
    using OpenGameEngine.GameObjects;

    public class GameSceneCollection
        : KeyedCollection<String, GameScene>
    {
        public GameSceneCollection()
            : base()
        {
        }

        protected override void ClearItems()
        {
            foreach (GameScene scene in this)
                scene.Dispose();

            base.ClearItems();
        }

        protected override string GetKeyForItem(GameScene item)
        {
            return item.Name;
        }
    }
}
